package br.eng.eliseu.gwt.gestaoWeb.shared;

import java.util.ArrayList;
import java.util.List;

public class ServiceException extends RuntimeException {

	private static final long serialVersionUID = -1458882762697237670L;

	private List<ServiceMessage> messagesList = new ArrayList<ServiceMessage>();
	
	
	
	public ServiceException(){}

	public ServiceException(Throwable e){
		super(e);
	}
	
	public ServiceException(String message, Throwable e){
		super(message, e);
		this.messagesList.add(new ServiceMessage(null, message));
	}
	
	public ServiceException(String key, String message){
		this.messagesList.add(new ServiceMessage(key, message));
	}
	
	public ServiceException(String key, String message, Throwable e){
		super(message, e);
		this.messagesList.add(new ServiceMessage(key, message));
	}
	
	public ServiceException(List<ServiceMessage> messages ){
		this.messagesList=messages;
	}
	
	public ServiceException(String message) {
		super(message);
		this.messagesList.add(new ServiceMessage(null, message));
	}

	
	
	public List<ServiceMessage> getMessagesList() {
		return messagesList;
	}
	public void setMessagesList(List<ServiceMessage> messagesList) {
		this.messagesList = messagesList;
	}

}
